package com.itheima.homework.加强训练.Test1;

/**
 * @Author 王加鑫
 * @Date 2021/5/10 20:47
 * @Version 1.0
 */
public class AnimalTest {
    public static void main(String[] args) {
        //匿名内部类
         Animal animal = useAnimal(new Animal() {
            @Override
            public void eat() {
                System.out.println("老鼠爱大米");
            }
         });
         animal.eat();

         //lambda表达式
        Animal animal1 = () -> System.out.println("\uD83D\uDC31吃\uD83D\uDC2D");
        animal1.eat();


    }

    public static Animal useAnimal(Animal animal){
        return animal;
    }
}
